home *** CD-ROM | disk | FTP | other *** search
/ PC-Blue - MS DOS Public Domain Library / PC-Blue MS-DOS Public Domain Library - NYACC.iso / vol430 / tcutil.arc / TCDEBUG.DOC < prev    next >
Encoding:
Text File  |  1987-09-11  |  22.7 KB  |  859 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.                                                            September 11, 1987
  9.  
  10.                              TCdebug Version 0.02
  11.  
  12.                     (C) Copyright 1987 by L. David Baldwin.  
  13.                              All Rights Reserved.
  14.  
  15.   Further copyright information given below
  16.  
  17.  
  18.   OVERVIEW
  19.  
  20.   TCdebug is an experimental source code debugger for use in debugging Turbo 
  21.   C (tm) Programs on the IBM-PC (tm).  Its goal is to allow source code 
  22.   debugging in all of Turbo C's memory models and with most of the possible 
  23.   compile and link options.  TCdebug allows you to:
  24.  
  25.        1.  View your source code (and, optionally, the assembly language 
  26.            code) while debugging.
  27.        2.  Trace the operation of your program by source code lines or by 
  28.            assembly language instructions.
  29.        3.  Insert breakpoints in your program by function name, by line 
  30.            number, or hexadecimal address.
  31.        4.  Examine (and change) simple global variables by symbolic name.  
  32.            Local variables may also be examined and changed, but require that 
  33.            the proper displacement on the stack be known. 
  34.        5.  Set up a Watch window to keep continuous tabs on a variable.
  35.  
  36.   TCdebug is not a finished program.  It is being released at this time to 
  37.   get an indication of interest and to obtain assistance in finding bugs and 
  38.   problems which are probably numerous at this time.
  39.  
  40.   TCdebug is designed exclusively for debugging Turbo C programs.  It should 
  41.   not be used on programs generated by other compilers.
  42.  
  43.  
  44.   SYSTEM REQUIREMENTS
  45.  
  46.        1.  An IBM-PC, AT, or compatible.  Screen compatibility is a must.
  47.        2.  PC-DOS 2.0 or above.
  48.        3.  Approximately 135k more memory than would normally be required to 
  49.            run the program to be tested.
  50.  
  51.  
  52.   PREPARATION
  53.  
  54.   TCdebug requires that a Map file for your program be present to supply 
  55.   information on the program symbols and line number locations.  When 
  56.   compiling and linking with TC, the options can be set with O/C/C/L and 
  57.   O/L/M/P.  With TCC use -M and -y.
  58.  
  59.  
  60.  
  61.  
  62.                                       1
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.   When starting a debugging session, the following files should be on the 
  75.   default drive:
  76.  
  77.     PROG.EXE    (or, optionally, .COM for the Tiny Model)
  78.     PROG.MAP    the map file
  79.     various.C   all the source files for the program (or at least all that 
  80.                 will be accessed.)
  81.  
  82.  
  83.  
  84.   OPERATION
  85.  
  86.   TCdebug may be started by entering the filename of the program to be 
  87.   debugged and any parameters which it requires on the command line, as:
  88.  
  89.     TCdebug PROG <other stuff>
  90.  
  91.   Here, PROG is the name of the program to be tested with EXE being the 
  92.   default extension.  <other stuff> will be passed on to PROG as its command 
  93.   line when execution begins.  If TCdebug is called without parameters, a 
  94.   request will be made for them.
  95.  
  96.   When execution begins, TCdebug loads the Map file, the EXE file and reports 
  97.   some facts about the program.  Note should be made of whether pointers are 
  98.   regarded as Near or Far by default as this will be important when 
  99.   displaying pointers later.
  100.  
  101.   After "hitting any key", the program is executed to "main()" and the 
  102.   debugging screen appears.  The debugging screen is divided into two parts.  
  103.   The lower section is the command and data section.  The '*' is a prompt for 
  104.   one of the commands described later.  The top part of the screen displays 
  105.   the program source code text which at this point will be centered at the 
  106.   first statement in main().  Source code line numbers appear at the left 
  107.   with the current line (the one to be executed next) being highlighted.
  108.  
  109.   Dividing the two portions of the debugging screen is a line which shows the 
  110.   name of the source file presently displayed.
  111.  
  112.   Two keys which can be tried at this point are the F9 and F10 keys.  The 
  113.   F9 key toggles into and out of the assembly mode.  When in assembly mode, 
  114.   the assembly language instructions of the program are displayed with the 
  115.   source code lines interspersed.  The F10 key toggles between the debugger 
  116.   screen and the screen which receives program output.
  117.  
  118.  
  119.   SPECIAL KEYS FOR VIEWING TEXT
  120.  
  121.   The following keys may be used to change the text being displayed:
  122.  
  123.        Pg Up
  124.        Pg Dn       Move the display up or down one page.
  125.  
  126.  
  127.  
  128.                                       2
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.        ^Pg Up
  141.        ^Pg Dn      Move to the start or end of the current file.
  142.  
  143.        Up arrow
  144.        Down arrow  Scroll up or down one line.
  145.  
  146.        ^Left Arrow  (with Scroll Lock on)
  147.        ^Right Arrow (with Scroll Lock on)
  148.                    Scroll horizontally left and right.
  149.  
  150.        F9 key      Toggle in and out of assembly mode.
  151.  
  152.        F10 key     Toggle between the debug screen and the screen
  153.                    of the program under test.
  154.  
  155.        Alt-U       Move dividing line up one line.
  156.        Alt-D       Move dividing line down one line.
  157.  
  158.   In addition, the text being displayed may be changed using the View command 
  159.   described later.
  160.  
  161.  
  162.   COMMAND EDITOR
  163.  
  164.   Commands are entered at the '*' prompt.  When entering commands, the 
  165.   following keys may used to edit the command:  (They perform the same 
  166.   functions as they do in the Turbo C editor.)
  167.  
  168.        ^A,^S,^D,^F,^G,^T,^H,^V,^Y,LFARW,RTARW,^LFARW,^RTARW,
  169.        Ins, Del, Backspace
  170.  
  171.   The Insert mode (default) is indicated by a slightly fatter cursor.  The 
  172.   cursor is normal in the Overwrite mode.
  173.  
  174.   In addition, a stack of the last 6 commands (those having more than 3 
  175.   characters) is maintained.  The F3 key accesses the stored commands from 
  176.   the most recent to the oldest and the F5 key accesses them in the reverse 
  177.   order.  These old commands may be used as is or may be modified by editing 
  178.   them.
  179.  
  180.   Note that commands are not acted upon until the Enter key is hit.  (The 
  181.   cursor does not have to be at the line end to enter the command.)
  182.  
  183.  
  184.   COMMAND PARAMETERS
  185.  
  186.   TCdebug uses one or two letter commands.  The command is often followed by 
  187.   one or more parameters.  Parameters are delimited from the command and each 
  188.   other using spaces.  The one exception to this is the format parameter 
  189.   which is preceded by a comma.  The parameters which may be used are:
  190.  
  191.  
  192.  
  193.  
  194.                                       3
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.     <Symbol>
  207.        A C source code symbol representing a function name or variable as 
  208.        appropriate.  The leading underbar added by the compiler has been 
  209.        stripped off, so symbols are entered exactly as used in the source 
  210.        program.  Case is significant (unless the non case sensitive link 
  211.        option was selected).
  212.  
  213.        The special symbols, _AX, _AL, _BX, etc. may be used to refer to the 
  214.        hardware registers.
  215.  
  216.     <Line Number>
  217.        Line numbers are entered as <filename>\<number> as:
  218.            myprog.c\345
  219.  
  220.        In most cases, the <filename> part can be dropped.  An entry of the 
  221.        form
  222.  
  223.            \345
  224.  
  225.        implies line number 345 in the currently displayed source file.  
  226.        (Currently, the '\' also may be dropped and a simple decimal entry will 
  227.        do.  However, the '\' may be required in future versions.)
  228.  
  229.     <Hexaddress>
  230.        Normal numerical entry in TCdebug is decimal with hex entries allowed 
  231.        by preceding them with '0x'.  However, numerical address entries must 
  232.        be entered in hex to distinguish them from line numbers.  A 
  233.        <hexaddress> takes the following form:
  234.  
  235.            0x1234:0x1ABC
  236.            es:bx+2
  237.            SS:BP-0X5a
  238.  
  239.        As indicated above, register names are allowed in address 
  240.        specifications.  The _current_ value in the register is used--the 
  241.        address does not change if the register value later changes.  The 
  242.        segment part of the <hexaddress> may be dropped as in:
  243.  
  244.            bp-0xA
  245.            0x123
  246.            bx
  247.  
  248.        If no segment is present in the entry, there is an implied segment.  
  249.        The rules for determining the implied segment are:
  250.  
  251.        1.  If the BP register is used, SS is implied.
  252.        2.  If BX,SI,DI are used (but not BP), DS is implied.
  253.        3.  If none of the above and a data entry is expected, DS is implied.
  254.        4.  If a code address is expected, the current CS is implied.
  255.  
  256.  
  257.  
  258.  
  259.  
  260.                                       4
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.     <Format>
  273.        Format parameters are entered as one or two letters preceded by a 
  274.        comma.  Case is significant.  The purpose of the <format> parameter is 
  275.        to inform TCdebug of the size and type of a variable as this 
  276.        information is not available in the Map file.  <format> parameters 
  277.        correspond to those used in the C 'printf' function.  Currently 
  278.        supported are:
  279.  
  280.            c,s,i,d,u,x,X,o,p,g,G,li,ld,lx,lX,lo,Np,Fp,lg,lG
  281.  
  282.        For the p (pointer) format, the default pointer size for the selected 
  283.        memory model is used.  This size is indicated in the information 
  284.        presented at startup.  To override the default, use either N or F as 
  285.        appropriate.
  286.  
  287.        The c (character) format has been used as a catchall for byte size 
  288.        items.  Display is in quoted character form, decimal, and hex.  Change 
  289.        entries may be made using any of those forms.
  290.  
  291.  
  292.   COMMANDS
  293.  
  294.   G    (Go)
  295.  
  296.     Format:
  297.        G [<parameter> [<parameter..]]
  298.  
  299.     The Go command starts execution of the program under test.  Execution 
  300.     will continue until a breakpoint is reached or the program terminates.
  301.  
  302.     One or more breakpoints may be entered with the Go command.  These 
  303.     breakpoints are called temporary breakpoints as they are in effect only 
  304.     until the first stopping point is reached.  Any temporary breakpoint 
  305.     would then have to reentered with the next Go command if desired.
  306.  
  307.     Examples:
  308.  
  309.        G   Start execution with no temporary breakpoints. (There might be 
  310.            some permanent breakpoints, however.)
  311.  
  312.        G \345 funct1 0x113
  313.            Start execution with temporary breakpoints at line number 345, at 
  314.            the start of function, funct1, and at address CS:0x113. In 
  315.            addition, there might be other permanent breakpoints in effect.
  316.  
  317.   T    (Trace)
  318.  
  319.     Format:
  320.        T   (or F7 key)
  321.  
  322.     In source code mode, execute the code on the current line.  Execution 
  323.     will stop at the next encountered line number.  If the current line 
  324.  
  325.  
  326.                                       5
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.     contains a function call, the break will be at the start of the 
  339.     function.
  340.  
  341.     In assembly mode (assembly code is displayed), execute the next assembly 
  342.     language instruction.
  343.  
  344.  
  345.   N    (Next)
  346.  
  347.     Format:
  348.        N    (or F8 key)
  349.  
  350.     In source code mode, execute the code on the current line in its 
  351.     entirety.  In assembly mode, this command currently does nothing.
  352.  
  353.     The difference between the Trace and the Next command is that if the 
  354.     current line contains a function call, Next will completely execute the 
  355.     function whereas Trace will Trace through the function.
  356.  
  357.  
  358.   P    (Permanent breakpoint)
  359.  
  360.     Format:
  361.        [-]P [<parameter>]
  362.  
  363.     The P command is used to specify permanent breakpoints.  Unlike temporary 
  364.     breakpoints, permanent breakpoints remain in effect until removed (using 
  365.     a '-' preceding the P command).  
  366.  
  367.     If no parameter is entered, the breakpoints in effect are listed.
  368.  
  369.     Passcounts are not implemented at this time.
  370.  
  371.     Examples:
  372.  
  373.        P              List all permanent breakpoints.
  374.       -P              Delete all permanent breakpoints.
  375.        P moda.c\345   Install a breakpoint at line 345 in file moda.c.
  376.       -P funct1       Remove a breakpoint at function funct1.
  377.        P 0x34b        Install a breakpoint at CS:034B.
  378.  
  379.  
  380.   V    (View text)
  381.  
  382.     Format:
  383.        V [<parameter>]
  384.  
  385.     The View command may be used to change the text being observed 
  386.     in the text window.  If no parameter is entered, the text will 
  387.     be centered around the current line.
  388.  
  389.     Examples:
  390.  
  391.  
  392.                                       6
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.        V initscreens   View text at function initscreens.
  406.        V \545          View text around line 545.
  407.  
  408.  
  409.   VF   (View File)
  410.  
  411.     Format:
  412.        VF <filename>
  413.  
  414.     The View command is for viewing the program source files.  The VF 
  415.     command allows any ASCII file to be displayed.
  416.  
  417.  
  418.   E    (Examine/change variable) 
  419.  
  420.     Format:
  421.        E <symbol>|<hexaddress> , <format>
  422.  
  423.     The Examine/change command allows the the value of a simple variable to 
  424.     be displayed and optionally changed.  Global variables may be referred to 
  425.     symbolically.  Auto and static variables must be referred to by a 
  426.     <hexaddress>.  Pointers may be resolved using one or more '*'s preceding 
  427.     the symbol or address.  <format> indicates the type of display wanted.
  428.  
  429.     After a variable value is displayed in response to the Examine/change 
  430.     command, a new value may be optionally entered followed by the Enter key.  
  431.     The Enter key by itself is used if no new value is desired.
  432.  
  433.     String variables are displayed as a string within quotes.  When 
  434.     specifying a change to a string variable, the new string should be 
  435.     enclosed in double quotes.  A null string is specified by two quotes 
  436.     enclosing nothing.
  437.  
  438.  
  439.     Examples:
  440.  
  441.        E flt,g
  442.        E dble,lg
  443.        E *st,c
  444.        E es:bx,u
  445.        E bp-0x52, s
  446.  
  447.     When referring to registers, note that there is a difference between the 
  448.     register symbols with underbars and those without the underbars, so that:
  449.  
  450.        E ds:bx,x  Examine/change the hex integer at the address ds:bx.
  451.        E bx,x     The same thing (DS is implied).
  452.        E _BX,x    Examine/change the BX register.
  453.  
  454.  
  455.  
  456.  
  457.  
  458.                                       7
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.   W    Watch variable
  471.  
  472.     Format
  473.        W <symbol>|<hexaddress> , <format>
  474.     [-]W [<number>]
  475.  
  476.     The Watch command opens up a watch window so that the specified variable 
  477.     is displayed continuously.  The value displayed is updated whenever 
  478.     TCdebug regains control.  The syntax for watch variable entry is 
  479.     identical to that used with the Examine command.  
  480.  
  481.     When watch variables are displayed, they are given a number.  The number 
  482.     is useful for selectively deleting them using the -W command.
  483.  
  484.     Examples:
  485.        W var1, u    Watch the unsigned variable, var1
  486.        W *bp-4,c    Watch the char variable pointed to by SS:BP-4
  487.        W _AL,c      Watch the AL register
  488.       -W 1          Delete watch variable #1
  489.       -W            Delete all watch variables  
  490.  
  491.  
  492.   R    (Register Display)
  493.  
  494.     Format:
  495.        R
  496.  
  497.     The Register display command displays the current machine register 
  498.     contents.  
  499.  
  500.  
  501.   RE   (Restart program under test)
  502.  
  503.     Format:
  504.        RE
  505.  
  506.     Reloads a fresh version of the test program and restarts it from the 
  507.     beginning.  Breakpoints and watch variables remain in effect.
  508.  
  509.  
  510.   WD   (Window Divide)
  511.  
  512.     Format:
  513.        WD [n]
  514.  
  515.     The Window Divide command allows the line dividing the screen to be moved 
  516.     up or down.  n is the desired line position.  If n is not entered, the 
  517.     line position is not changed but the screen is refreshed.
  518.  
  519.     The line dividing the screen may also be moved one line at a time using 
  520.     Alt-U (Up) or Alt-D (Down).
  521.  
  522.  
  523.  
  524.                                       8
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.   Q    (Quit)
  537.  
  538.     Format:
  539.        Q
  540.  
  541.     The Quit command ends debugging without running the program under test to 
  542.     completion.  However, the program's exit() routine is executed, so that 
  543.     files are closed, etc.  You will be asked if you wish to restart the 
  544.     program.  
  545.  
  546.  
  547.   DG   (DebuG)
  548.  
  549.     Format:
  550.        DG
  551.  
  552.     This command is used to enter an optional external assembly language 
  553.     debugger.  It is used mainly for debugging TCdebug.
  554.  
  555.  
  556.   HINTS
  557.  
  558.   It is possible to insert breakpoints in the source code using 
  559.   geninterrupt(3).  These breakpoints cannot be removed by TCdebug but may be 
  560.   useful for conditional breaks.  For instance:
  561.  
  562.     if (i==49) geninterrupt(3);
  563.  
  564.   If you mistakenly Trace into a function you wanted to skip using Next, use 
  565.   G \n, where n is the last line number in the function, then one Trace will 
  566.   get you back to the original line of code.  Hopefully, there will be a 
  567.   'Return' command in the future which will make this easier.
  568.  
  569.   If, in the assembly mode, you trace into a library routine and can't find 
  570.   your way out, toggle out of assembly mode (F9).  Even if the source code 
  571.   screen is blank at this time, a single Trace will get you to the next line 
  572.   number.
  573.  
  574.   Avoid assembly tracing of the 8087 emulation code.
  575.  
  576.   Auto (stack) variables can be Examined or Watched by using the disassembly 
  577.   listing to determine their position on the stack relative to the BP 
  578.   register.  When doing this, be sure that the BP register is valid.  In 
  579.   particular, the BP register is not valid immediately on entry to the 
  580.   function.  One source line trace must be made (or several assembly 
  581.   instructions passed) before the BP register is correct.
  582.  
  583.   The Huge memory model has the same sort of problem with the DS register 
  584.   which changes between modules.  In this case, it only effects the 
  585.   disassembly listing.  The data symbols will not be correctly listed until 
  586.   the DS register has been setup.
  587.  
  588.  
  589.  
  590.                                       9
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.   RESTRICTIONS, PROBLEMS, BUGS
  604.  
  605.   The following are current limits (somewhat arbitrarily set).  
  606.  
  607.     Permanent and temporary breakpoints are limited to 5 each.
  608.     Maximum file size for displayed files = 40k.
  609.     Maximum number of line numbers (only those with code count) = 3000.
  610.     Maximum number of program modules accommodated = 20.
  611.     Maximum number of symbols = 700.
  612.  
  613.   A simple screen swap is currently used.  This limits debugging to text only 
  614.   programs.  Snow may be horrendous at this time.
  615.  
  616.   The map file for the Tiny memory model has some peculiarities in data 
  617.   addresses which I haven't got figured out yet.  This affects a number of 
  618.   library data symbols but only seems to affect one or two source symbols.  
  619.   The problem shows up in the assembly listing where the affected symbols are 
  620.   not correctly displayed.
  621.  
  622.   The 8087 emulation code turns into a mess when disassembly is attempted.
  623.  
  624.   Currently, non default pointers cannot be resolved by the 'E' or 'W' 
  625.   commands.  That is:
  626.  
  627.     E *st,c
  628.  
  629.   will always resolve st as a far pointer if the default is far.  Probably 
  630.   some sort of cast will have to allowed, as:
  631.  
  632.     E *(near*)st,c
  633.  
  634.  
  635.   COPYRIGHT
  636.  
  637.   Documentation and Program (C) Copyright 1987 by L. David Baldwin.  
  638.   All Rights Reserved.
  639.  
  640.   TCdebug may be copied and distributed freely by individuals to friends and 
  641.   acquaintances providing that no fee is charged and it is not part of a 
  642.   package for which a charge is made.
  643.  
  644.   The uploading of TCdebug to any bulletin board except that of the Borland 
  645.   Sig (CompuServe) is expressly forbidden.
  646.  
  647.  
  648.   TRADEMARKS
  649.  
  650.        IBM-PC is a trademark of International Business Machines 
  651.        Corporation.
  652.        Turbo C is a trademark of Borland International Inc.
  653.  
  654.  
  655.  
  656.                                      10
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.   Please report all bugs, suggestions, and problems to Dave 
  671.   Baldwin, CompuServe ID #76327,53.
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.                                      11
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.   APPENDIX A -- COMPILER OPTIONS
  735.  
  736.   As mentioned earlier, it is mandatory that the map file generation and line 
  737.   number options be turned on.  The effect of some of the other compiler 
  738.   options on debugging are discussed below.  Some of this is just guess work 
  739.   at this stage as not all have actually been tested.
  740.  
  741.   Standard Stack Frame
  742.     Unimportant at this time but may be mandatory in the future when other 
  743.     features are added.
  744.  
  745.   Register Optimization
  746.     Borland suggests off.  I haven't tried this one but I suspect that it 
  747.     confuses things somewhat.  Those adept at assembly language may not have 
  748.     too much trouble.
  749.  
  750.   Jump Optimization
  751.     Same as register optimization.
  752.  
  753.   80186/80286 Code Generation
  754.     Off is best here.  The disassembler in TCdebug currently does not 
  755.     understand the new instructions.
  756.  
  757.   Use Register Variables
  758.     Off might be somewhat better although I've never turned it off.  When on, 
  759.     you may have to figure out which variables the compiler decided to store 
  760.     in registers.  
  761.  
  762.   8087 vs Emulation
  763.     If you have a choice, by all means select straight 8087.  The emulated 
  764.     code does not disassemble in any meaningful way.
  765.  
  766.   Non Case Sensitive Link
  767.     If this option is selected, symbols will appear in uppercase.  Symbol 
  768.     entries may be made in either case.
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.                                      12
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.   APPENDIX B -- SOURCE CODE FORMATTING
  801.  
  802.   With modern compilers, line numbers often do not correspond to the code 
  803.   generated in the manner that you might expect.  Layout of the source code 
  804.   can help in this respect.  While you probably don't want to reformat all 
  805.   your present code, you may want to change your formatting for code yet to 
  806.   be written.
  807.  
  808.   The most obvious format change is to only have one source statement per 
  809.   line.  With more than one statement on a line, line numbers can't be used 
  810.   to set a breakpoint on the second statement and the Trace command will 
  811.   trace multiple statements.
  812.  
  813.   Statements split between two lines do not cause much trouble.
  814.  
  815.   The 'else' in an 'if' statement causes a difficulty.  Consider the 
  816.   following code:
  817.  
  818.   100  if (...)
  819.   101     {..do something..}
  820.   102  else {..do something else..}
  821.   103
  822.  
  823.   To put a breakpoint on the ..do something else.. one might try a break on 
  824.   line 102.  But the else here actually generates a jump instruction (to line 
  825.   103) so ..do something else.. is inaccessible except by using a code 
  826.   hexaddress.  A better format is:
  827.  
  828.   100  if (...)
  829.   101     {..do something..}
  830.   102  else 
  831.   103     {..do something else..}
  832.   104
  833.  
  834.   The 'for' statement also causes problems.  The decision code for the 'for' 
  835.   statement is actually done at the bottom of the loop and often is included 
  836.   as part of the next line where you would normally think the statement was 
  837.   completed.  The best solution here is to add a blank line after the 'for' 
  838.   statement loop.
  839.  
  840.   In short, it's best to use plenty of vertical spacing and blank lines.  
  841.   Also take a peek at the assembly code to see what's going on.
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.                                      13
  855.  
  856.  
  857.  
  858.  
  859.